#include<bits/stdc++.h>
using namespace std;
int n;
int a[100010],b[100010],c[100010];
int dp[100010][10];
int main(){
	freopen("summer.in","r",stdin);
	freopen("summer.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d%d",&a[i],&b[i],&c[i]);
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
	}
	printf("%d",max(dp[n][0],max(dp[n][1],dp[n][2])));
	return 0;
}
